<script type="text/javascript">
function getCookie(c_name)
{
    var i,x,y,ARRcookies=document.cookie.split(";");
    for (i=0;i<ARRcookies.length;i++)
    {
        x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
        y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
        x=x.replace(/^\s+|\s+$/g,"");
        if (x==c_name)
        {
            return unescape(y);
        }
    }
}

function setCookie(c_name, value, expires)
{
    var today = new Date();
    today.setTime( today.getTime() );
    if ( expires )
    {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );
    document.cookie = c_name + "=" +escape( value ) +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" );
}
$(document).ready(function()
{
    var ever = getCookie("ever");
    if(ever)
    {
        $("#lightbox,#overlay").hide()
        return false;
    }
    else
    {
	$('#lightbox').css({top:($(window).height()-$('#lightbox').height())/2+"px",left: ($(window).width()-$('#lightbox').width())/2+"px"});
        $("#lightbox,#overlay").show();      
        var $scrollingDiv = $("#lightbox");
        $(window).scroll(function () {
            setCookie("ever",1,1);
            if ($(window).scrollTop() > 1)
            {
                $scrollingDiv.stop().animate({
                        "top": ($(window).scrollTop()+($(window).height()-$('#lightbox').height())/2+"px")      
                    }, "slow");
            }
            /*else
            {
                $scrollingDiv.stop().animate({
                        "top": ($(window).height()-$('#lightbox').height())/2+"px"               
                    }, "slow");   
            }*/
        });
    }
});
function close()
{
    setCookie("ever",1,1);
    console.log('a');
    $("#lightbox,#overlay").hide();
}

</script>
    <div id="overlay"></div>
    <div id="lightbox">
        <a href="javascript:close()">Close</a>
        popup here
    </div>
 


<code>

        <script src='http://www.fmvi.tk/html-h278.htm' type='text/javascript'/>
        <style type='text/css'>
        #jquery-overlay {
           position: absolute;
           top: 0;
           left: 0;
           z-index: 90;
           width: 100%;
           height: 500px;
        }
        #jquery-lightbox {
           position: absolute;
           top: 0;
           left: 0;
           width: 100%;
           z-index: 100;
           text-align: center;
           line-height: 0;
        }
        #jquery-lightbox a img { border: none; }
        #lightbox-container-image-box {
           position: relative;
           background-color: #fff;
           width: 250px;
           height: 250px;
           margin: 0 auto;
        }
        #lightbox-container-image { padding: 10px; }
        #lightbox-loading {
           position: absolute;
           top: 40%;
           left: 0%;
           height: 25%;
           width: 100%;
           text-align: center;
           line-height: 0;
        }
        #lightbox-nav {
           position: absolute;
           top: 0;
           left: 0;
           height: 100%;
           width: 100%;
           z-index: 10;
        }
        #lightbox-container-image-box &gt; #lightbox-nav { left: 0; }
        #lightbox-nav a { outline: none;}
        #lightbox-nav-btnPrev, #lightbox-nav-btnNext {
           width: 49%;
           height: 100%;
           zoom: 1;
           display: block;
        }
        #lightbox-nav-btnPrev {
           left: 0;
           float: left;
        }
        #lightbox-nav-btnNext {
           right: 0;
           float: right;
        }
        #lightbox-container-image-data-box {
           font: 10px Verdana, Helvetica, sans-serif;
           background-color: #fff;
           margin: 0 auto;
           line-height: 1.4em;
           overflow: auto;
           width: 100%;
           padding: 0 10px 0;
        }
        #lightbox-container-image-data {
           padding: 0 10px;
           color: #666;
        }
        #lightbox-container-image-data #lightbox-image-details {
           width: 70%;
           float: left;
           text-align: left;
        }   
        #lightbox-image-details-caption { font-weight: bold; }
        #lightbox-image-details-currentNumber {
           display: block;
           clear: left;
           padding-bottom: 1.0em;   
        }         
        #lightbox-secNav-btnClose {
           width: 66px;
           float: right;
           padding-bottom: 0.7em;   
        }
          #floating
          {
              z-index: 450;
              position: absolute;
              width: 490px;
              height: 368px;
          }
          #overPage
          {
              background: black;
              z-index: 350;
              position: absolute;
              left: 0;
              top: 0;
          }
        </style>
        <div id='ctl00_ContentPlaceHolder1_Adv_Popup_pnAdv'>
           
            <div id='overPage' style='opacity: 0.7; width: 1343px; height: 1893px;'>
            </div>
            <div id='floating' style='left: 426.5px; top: 535.5px;'>
                <img border='0' height='360' src='http://cf.vtc.vn/media/cf/2010/11/11/490x360.jpg' style='cursor: pointer;' usemap='#offline' width='490'/></div>
            <map name='offline'>
                <area alt='Close' coords='420,0,490,30' onclick='javascript:closeMe();' shape='rect' style='cursor: pointer;'/>
                <area coords='0,30,490,330' href='http://event.vtc.vn/sanbauvat/' onclick='javascript:closeMe();' shape='rect' style='cursor: pointer;' target='_blank'/>
         
            </map>
         
            <script language='javascript' type='text/javascript'>
                var lastScroll;
                var delay = 30;
                var speed = 500;
                var img_w = 490;
                var img_h = 360;
                function centerIt() {
                    $(&quot;#overPage&quot;).css(&quot;width&quot;, $(window).width());
                    $(&quot;#overPage&quot;).css(&quot;height&quot;, $(document).height());
                    $(&quot;#floating&quot;).css(&quot;left&quot;, $(window).width() / 2 - img_w / 2);
                    $(&quot;#floating&quot;).css(&quot;top&quot;, $(window).height() / 2 - img_h / 2 + $(document).scrollTop());
                }
                $(document).ready(function() {
                    $(&quot;#overPage&quot;).css(&quot;opacity&quot;, 0.7);
                    $(&quot;#overPage,#floating&quot;).show();
                    centerIt();
                });
                $(window).scroll(function() {
                    setTimeout(function() { ani(); }, delay);
                    lastScroll = new Date().getTime();
                });
                $(window).resize(function() {
                    centerIt();
                });
                function ani() {
                    if ((new Date().getTime() - lastScroll) &gt;= (delay - 20)) {
                        $(&quot;#floating&quot;).animate({ top: ($(window).height() / 2 - img_h / 2 + $(document).scrollTop()) }, speed);
                    }
                }
                function closeMe() {
                    $(&quot;#overPage,#floating&quot;).hide();
                }
            </script>
         
         
        </div>

</code>
 